
*** This do file generates panel A of figure B11 in the minimum wage precommitment paper

*** BJS event study using the year of first statutory increase as the first treatment year 
*** prime age individuals with no controls, looking at large and small statutory increasers separately

set more off
cap log close
clear all

graph drop _all

* Set path* If needed change global path to point to directory where files are stored on your computer
*global path "I:/DataSets5/Duncan/Dropbox/Recent Minimum Wage Changes/2020.12 NBER Update/JOLE Precommittment Replication"
global dtadir "$path/Data"
global tabdir "$path/Tables"
global figdir "$path/Figures"
global estdir "$path/Estimates"
global logdir "$path/Logfiles"

log using "$logdir/BJS-prime-age-policy-categories-no-controls-drop-indexers.log", replace

* Load data
use "${path}/Data/ACSEventStudiesData.dta", replace

* Generate sample dummies
gen lowskill = 0
replace lowskill = 1 if dropout == 1 & inrange(age,16,25)

gen young = 0
replace young = 1 if inrange(age,16,21)

gen primeage = 0
replace primeage = 1 if inrange(age,26,54)

gen primeagehighskill = 0 
replace primeagehighskill = 1 if inrange(age,26,54) & educ > 6 & !missing(educ)

* Drop all states that were originally indexers
drop if indexer == 1

est clear

set seed 123456

preserve
keep if primeage == 1

* Gen ID for each oabservation
gen id = _n

* Generate relative periods
gen K = year - legimpyear1

* Manually bin distant periods using wtr function
count if K == 0
gen tau0 = (K== 0)/r(N)
count if K == 1
gen tau1 = (K==1)/r(N)
count if K == 2
gen tau2 = (K==2)/r(N)
count if K == 3
gen tau3 = (K==3)/r(N)
count if K >= 4 & !missing(K)
gen tau4 = (K>=4 & !missing(K))/r(N)


* Prime Age Higher Skilled No Controls Large Increasers
did_imputation employed id year legimpyear1 if indexer == 0 & StatIncreaserSmall == 0, wtr(tau0 tau1 tau2 tau3 tau4) fe(statefip year) cluster(statefip) pretrends(3) maxit(1000) verbose
estimates store primeage_none_large

* Prime Age Higher Skilled No Controls Small Increasers or Indexers. Make sure Maine is only included in the large increaser results above and not also the small increaser results
did_imputation employed id year legimpyear1 if StatIncreaserLarge == 0 & statefip != 23, wtr(tau0 tau1 tau2 tau3 tau4) fe(statefip year) cluster(statefip) pretrends(3) maxit(1000) verbose
estimates store primeage_none_small

event_plot primeage_none_large primeage_none_small, together plottype(scatter) ciplottype(rspike) savecoef stub_lag(tau_tau#) noautolegend perturb(-0.2) ///
	graph_opt(title("Panel A: Prime Age No Controls", size(medsmall)) ytitle("", size(small)) xtitle("", size(small)) scheme(s2mono) ///
	xlabel(-3 "-3" -2 "-2" -1 "-1" 0 "0" 1 "1" 2 "2" 3 "3" 4 "4+", labsize(small)) ylabel(-.075 "-.075" -0.05 "-.050" -0.025 "-.025" 0 "0" .025 ".025", labsize(small) gmin gmax) ///
	legend(order(1 "Large Increasers" 3 "Small Increasers") region(lstyle(none)) rows(1) size(small) symxsize(small) symysize(small)) ///
	xline(-0.5, lpattern(dash) lcolor(black)) yline(0, lpattern(solid) lcolor(black)) bgcolor(white) graphregion(color(white)) name(primage_none_large_small, replace)) ///
	lag_opt1(color(black) msymbol(circle)) lag_opt2(color(black) msymbol(triangle)) lead_opt(color(black)) lag_ci_opt(color(black black)) lead_ci_opt(color(black black))
	graph save "$figdir/BJS/primeage-no-controls-policy-categories-drop-indexers.gph", replace

esttab primeage_none_large primeage_none_small using "$figdir/BJS/prime-age-no-controls-policy-categories-drop-indexers.csv", replace order(pre* tau*) wide noparentheses ///
	b(3) ci(3) ar(3) star(* 0.10 ** 0.05 *** 0.01) compress nogap noconstant mtitles("Large" "Small") ///
	scalars("pre_p Pretrend p-value" "pre_F Pretrend F Statistic")